<?php
/**
 * Created by PhpStorm.
 * User: Qch
 * Date: 2016/9/8
 * Time: 17:02
 */

namespace J\Storage;

use J\ICache;

abstract class Cache implements ICache
{
    public function getMulti($keys, $column = null)
    {
        $value = [];
        foreach ($keys as $key){
            $value[$key] = $this->get($key, $column);
        }
        return $value;
    }

    public function delete($keys)
    {
        if(is_array($keys)){
            foreach ($keys as $key){
                $this->itemDelete($key);
            }
            return true;
        }
        return $this->itemDelete($keys);
    }

    /**
     * 删除单个元素
     * @param int|string $key 元素索引
     * @return mixed
     */
    abstract protected function itemDelete($key);

    abstract public function get($key, $column = null);
}